<!DOCTYPE html>

<!--
Check that removing the preserve-3d attribute from a layer has the intended
effect. See https://bugs.webkit.org/show_bug.cgi?id=95732.

Passing criteria: green box shown without any visible red.
-->

<html>
<head>
  <style type="text/css" media="screen">
    body {
      -webkit-perspective: 400px;
    }

    .transformed-container {
      -webkit-transform-style: preserve-3d;
      transform: rotateX(90deg);
    }

    .reverse-transformed-child {
      transform: rotateX(-90deg);
    }

    .box {
      width: 100px;
      height: 100px;
    }

    .indicator {
      background: red;
    }

    .test {
      position: absolute;
      will-change: transform;
      background: green;
    }
  </style>

  <script src="../resources/run-after-layout-and-paint.js"></script>
  <script type="text/javascript">
    function doTest() {
      runAfterLayoutAndPaint(function() {
          document.getElementById('container').style.webkitTransformStyle = 'flat';
      }, true);
    }
    window.addEventListener('load', doTest);
  </script>
</head>

<body>
  <div class="test box"></div>
  <div id="container" class="transformed-container box">
    <div class="reverse-transformed-child indicator box"></div>
  </div>
</body>
</html>
